﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;

namespace BookBuy
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        public muasachEntities data = new muasachEntities();
        public List<THELOAI> dstheloai;
        public List<SANPHAM> dssachmoi;
        public List<SANPHAM> dssachbanchay;
        protected void Page_Load(object sender, EventArgs e)
        {
            dstheloai = data.THELOAIs.ToList();
            if (!IsPostBack)
            {      
                //Session.Add("GioHang", new GIOHANG());
                //Session.Add("CTGioHang", new List<CHITIETGIOHANG>());
                if (Cache["GioHang"] == null)
                {
                    GIOHANG giohang = new GIOHANG();
                    giohang.MAGH = -1;
                    Cache.Insert("GioHang", new GIOHANG(),null, DateTime.MaxValue, TimeSpan.FromMinutes(20));
                }
                if (Cache["CTGioHang"] == null)
                {
                    Cache.Insert("CTGioHang", new List<CHITIETGIOHANG>(), null, DateTime.MaxValue, TimeSpan.FromMinutes(20));
                }
            }
            
        }
        public void Change_Cart()
        {
            System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Đã thêm vào giỏ')</SCRIPT>");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Change_Cart();
            
        }   
    }
}
